// const fs= require ('fs')
const path = require('path')
const express = require('express')
const app = express()

/* 全局解析 */
const bodyParser = require('body-parser')
app.use(bodyParser.json())

app.use('/static', express.static(path.join(__dirname, '../static')))

const routerInit = require('./router/index')
// 获取所有路由
routerInit(app)
const swagger = require('./config/swagger')
swagger(app, 8081)
const server = app.listen(8081, function () {
  const host = server.address().address
  const port = server.address().port
  console.log('应用实例，访问地址为 http://%s:%s', host, port)
})

/* utf8、ucs2、ascii、binary、base64、hex */
/* fs.readFile("./src/xue1.pfx","base64",(err,data)=>{
  console.log(err?err:data)
}) */
